import Vue from 'vue'
import Router from 'vue-router'
import WebLayout from '../components/WebLayout.vue'
import AlreadyPut from '../components/dropBox/AlreadyPut.vue'
import CanOrderMan from '../components/dropBox/CanOrderMan.vue'
import CouldOrderMan from '../components/dropBox/CouldOrderMan.vue'
import DropBoxHistory from '../components/dropBox/DropBoxHistory.vue'
import DropBoxMan from '../components/dropBox/DropBoxMan.vue'
import EirMan from '../components/dropBox/EirMan.vue'
import OrderStatistics from '../components/dropBox/OrderStatistics.vue'
import AnnouncementMan from '../components/announcement/AnnouncementMan.vue'
import CompanySetting from '../components/companySetting/CompanySetting.vue'
import BasicCost from '../components/basicInfo/BasicCost.vue'
import Salesman from '../components/basicInfo/Salesman.vue'
import ShipCompany from '../components/basicInfo/ShipCompany.vue'
import DailyCollection from '../components/finance/DailyCollection.vue'
import MonthTable from '../components/finance/MonthTable.vue'
import DailyTable from '../components/finance/DailyTable.vue'
import BusinessCollection from '../components/finance/BusinessCollection.vue'
import CustomeMan from '../components/cpInfoMan/CustomeMan.vue'
import CpDataMaintain from '../components/cpInfoMan/CpDataMaintain.vue'
import SalesmanMan from '../components/userMan/SalesmanMan.vue'
import DepartmentMan from '../components/userMan/DepartmentMan.vue'
import PostMan from '../components/userMan/PostMan.vue'
import PrevisionSearch from '../components/prevision/PrevisionSearch.vue'

Vue.use(Router)

const router = new Router({
  routes: [
    { // 默认
      path: '/',
      redirect: '/webLayout/dropBoxMan'
    },
    { // 主视图
      path: '/webLayout',
      name: 'WebLayout',
      component: WebLayout,
      children: [
        { // 出口放箱 - 出口放箱管理
          path: 'dropBoxMan',
          name: '出口放箱管理',
          component: DropBoxMan
        },
        { // 出口放箱 - 出口放箱历史记录
          path: 'dropBoxHistory',
          name: '出口放箱历史记录',
          component: DropBoxHistory
        },
        { // 出口放箱 - 已放好客户
          path: 'alreadyPut',
          name: '已放好客户',
          component: AlreadyPut
        },
        { // 出口放箱 - 电子EIR管理
          path: 'eirMan',
          name: '电子EIR管理',
          component: EirMan
        },
        { // 出口放箱 - 可打单管理
          path: 'canOrderMan',
          name: '可打单管理',
          component: CanOrderMan
        },
        { // 出口放箱 - 已打单管理
          path: 'couldOrderMan',
          name: '已打单管理',
          component: CouldOrderMan
        },
        { // 出口放箱 - 打单统计
          path: 'orderStatistics',
          name: '打单统计',
          component: OrderStatistics
        },
        { // 公告管理 - 公告管理
          path: 'announcementMan',
          name: '公告管理',
          component: AnnouncementMan
        },
        { // 公司设置 - 公司设置
          path: 'companySetting',
          name: '公司设置',
          component: CompanySetting
        },
        { // 基础信息 - 基础费用
          path: 'basicCost',
          name: '基础费用',
          component: BasicCost
        },
        { // 基础信息 - 业务员
          path: 'salesman',
          name: '业务员',
          component: Salesman
        },
        { // 基础信息 - 船代公司
          path: 'shipCompany',
          name: '船代公司',
          component: ShipCompany
        },
        { // 财务统计 - 日汇总表
          path: 'dailyCollection',
          name: '日汇总表',
          component: DailyCollection
        },
        { // 财务统计 - 月统计表
          path: 'monthTable',
          name: '月统计表',
          component: MonthTable
        },
        { // 财务统计 - 日统计表
          path: 'dailyTable',
          name: '日统计表',
          component: DailyTable
        },
        { // 财务统计 - 业务汇总表
          path: 'businessCollection',
          name: '业务汇总表',
          component: BusinessCollection
        },
        { // 公司信息管理 - 客户管理
          path: 'customeMan',
          name: '客户管理',
          component: CustomeMan
        },
        { // 公司信息管理 - 公司资料维护
          path: 'cpDataMaintain',
          name: '公司资料维护',
          component: CpDataMaintain
        },
        { // 用户管理 - 业务员管理
          path: 'salesmanMan',
          name: '业务员管理',
          component: SalesmanMan
        },
        { // 用户管理 - 部门管理
          path: 'departmentMan',
          name: '部门管理',
          component: DepartmentMan
        },
        { // 用户管理 - 岗位管理
          path: 'postMan',
          name: '岗位管理',
          component: PostMan
        },
        { // 预配查询 - 预配查询
          path: 'previsionSearch',
          name: '预配查询',
          component: PrevisionSearch
        }
      ]
    }
  ]
})

router.beforeEach((to, from, next) => {
  router.app.$store.state.web.breadcrumb = to.name
  next()
})

export default router
